Utilization based multi-buffer dynamic adjustment management

ABSTRACT

Provided are techniques for utilization based multi-buffer dynamic adjustment management. A sub-buffer is assigned to each entity of multiple entities. A percentage utilization is determined for each entity. Based on the percentage utilization, for each sub-buffer assigned to each entity, one of one of allocating at least one random data segment from a free list of data segments and removing at least one data segment to change a size of the sub-buffer is performed.

FIELD

Embodiments of the invention relate to utilization based multi-bufferdynamic adjustment management.

BACKGROUND

A circular buffer may be described as any buffer which its one or moreusers consumes starting from a beginning location, continuing in a fixedorder, and going back to the beginning location after reaching the end.For example, a circular buffer may be created with a linked list of datasegments (memory segments or segments) or linear buffers that are usedto form a ring.

Sometimes different users share a circular buffer. Users may be any typeof consumer for the circular buffer, such as threads and processes. Whenaccessing a shared circular buffer (as may be the case for tracingprogram code), a lock is obtained to prevent users from stepping overeach other and rendering the data in the circular buffer incoherent. Onthe performance path, obtaining a lock may be problematic in anenvironment in which the number of threads accessing such a lock may belarge (e.g., in the hundreds). Even if a small percentage of thosethreads compete for that lock, there may be a lot of time spent waitingand not accomplishing critical tasks. A thread may be described as thesmallest sequence of programmed instructions that may be managedindependently by a scheduler, which is typically a part of the operatingsystem.

In some conventional systems, a task performed while the lock is held isoptimized to just what is critical (e.g., just claiming an amount ofspace currently needed and not using that space until after the lock hasbeen relinquished). This may improve performance, but, when a lot ofthreads are competing for that lock, there is a great likelihood ofthreads starving and critical tasks being stalled.

In some conventional systems, the circular buffer is split into as manycircular sub-buffers as there are threads. Then, each thread uses itsown sub-buffer. In this case, no lock is required, but significant skewsin the consumption amongst the threads may lead to inefficientutilization of the total circular buffer. For example, some sub-buffersmay wrap often, while other sub-buffers remain virtually empty.

In some conventional systems, a midway solution is to put the threadsinto small groups and divide the total circular buffer into as manysub-buffers as there are groups. The threads in each group use theassociated sub-buffer, and each group of threads handles its own privatelock, which reduces lock contention. If the threads are properlyaggregated to groups, their cumulative production may offer smallerskews between groups, thus a better distribution in buffer utilization.While this technique may decrease the inefficiency in buffer utilizationby averaging the group's individual threads' productions, having a “onesize fits all” sub-buffer for each group of diversified threads withindividually unpredictable production rate may still result intemporally localized inefficiencies. There will still be ebb and flow inutilization at the group level, thus creating skews.

SUMMARY

Provided is a computer program product for utilization basedmulti-buffer dynamic adjustment management. The computer program productcomprises a computer readable storage medium having program codeembodied therewith, the program code executable by at least oneprocessor to perform operations, the operations comprising: assigning asub-buffer to each entity of multiple entities; determining a percentageutilization for each entity; and based on the percentage utilization,for each sub-buffer assigned to each entity, performing one ofallocating at least one random data segment from a free list of datasegments and removing at least one data segment to change a size of thesub-buffer.

Provided is a computer system for utilization based multi-buffer dynamicadjustment management. The computer system comprises: one or moreprocessors, one or more computer-readable memories and one or morecomputer-readable, tangible storage devices; and program instructions,stored on at least one of the one or more computer-readable, tangiblestorage devices for execution by at least one of the one or moreprocessors via at least one of the one or more memories, to performoperations, the operations comprising: assigning a sub-buffer to eachentity of multiple entities; determining a percentage utilization foreach entity; and based on the percentage utilization, for eachsub-buffer assigned to each entity, performing one of allocating atleast one random data segment from a free list of data segments andremoving at least one data segment to change a size of the sub-buffer.

Provided is a method for utilization based multi-buffer dynamicadjustment management. The method comprises: assigning, with a processorof a computer, a sub-buffer to each entity of multiple entities;determining a percentage utilization for each entity; and based on thepercentage utilization, for each sub-buffer assigned to each entity,performing one of allocating at least one random data segment from afree list of data segments and removing at least one data segment tochange a size of the sub-buffer.

With embodiments, an entity is one or more threads or one or moreprocesses.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

In the drawings, like reference numbers represent corresponding partsthroughout.

FIG. 1 illustrates, in a block diagram, a computing environment inaccordance with certain embodiments.

FIG. 2 illustrates a data segment control structure in accordance withcertain embodiments.

FIG. 3 illustrates a sub-buffer control structure in accordance withcertain embodiments.

FIG. 4 illustrates a free list of data segments in accordance withcertain embodiments.

FIG. 5 illustrates a conceptual representation of a sub-buffer's datasegment ring in accordance with certain embodiments.

FIG. 6 illustrates sub-buffer information and statistics held by themanagement thread in accordance with certain embodiments.

FIG. 7 illustrates a trace data format in accordance with certainembodiments.

FIG. 8 illustrates, in a flowchart, operations performed forinitialization in accordance with certain embodiments.

FIG. 9 illustrates, in a flowchart, operations performed to re-size eachof the sub-buffers in accordance with certain embodiments.

FIGS. 10A and 10B illustrate, in a flowchart, operations performed forcounter collection and sub-buffer size entitlement calculation inaccordance with certain embodiments.

FIGS. 11A and 11B illustrate, in a flowchart, operations for decreasinga sub-buffer size in accordance with certain embodiments.

FIGS. 12A and 12B illustrate, in a flowchart, operations for increasinga sub-buffer size in accordance with certain embodiments.

FIGS. 13A and 13B illustrate, in a flowchart, operations performed for atrace in accordance with certain embodiments.

FIG. 14 illustrates a computing architecture in which the components ofFIG. 1 may be implemented.

DETAILED DESCRIPTION

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

Embodiments provide shared buffer management and utilization in acomputing device with a high performance requirement.

FIG. 1 illustrates, in a block diagram, a computing environment inaccordance with certain embodiments. In FIG. 1, a computing device 100includes a sub-buffer allocation system 110, at least one main buffer120, entities 130 a . . . 130 m (where the ellipses and the use of “a”and “m” indicate that there may be any number of entities in variousembodiments), and a free list of data segments 140.

In certain embodiments, the sub-buffer allocation system includes amanagement thread 112. However, in alternative embodiments, themanagement thread 112 is separate from the sub-buffer allocation system110. With various embodiments, the functionalities of calculating theamount of space to which a user is entitled and of dynamically changingthe sub-buffers' sizes may be performed by one component (e.g., themanagement thread 112) or may be separated among two components (thesub-buffer allocation system 110 and the management thread 112). Incertain embodiments, the management thread 112 may be a managementprocess.

The main buffer 120 has data segments 122 b . . . 122 n (where theellipses and the use of “b” and “n” indicate that there may be anynumber of data segments in various embodiments). With embodiments, themain buffer 120 is divided into sub-buffers 124 c . . . 124 p (where theellipses and the use of “c” and “p” indicate that there may be anynumber of sub-buffers in various embodiments) whose size is adaptivelychanged based on utilization. Each of the sub-buffers 124 c . . . 124 pis assigned one or more of the data segments 122 b . . . 122 n. Incertain embodiments, the main buffer 120 is composed of data segmentsthat are picked at random to form sub-buffers. With embodiments, themain buffer 120 describes a total amount of space allocated to handletracing. For example, this total amount of space may be divided intoequal sized data segments, and the data segments are used to formsub-buffers. The sub-buffers are utilized as circular buffers. Forexample, the data segments within a sub-buffer are listed in a closedchain (a ring).

An entity may be any user of the sub-buffers. In certain embodiments, anentity is a group of threads (which may be grouped using certaincriteria), and a sub-buffer is assigned to the group of threads. Incertain other embodiments, an entity is an individual thread, and thesub-buffer is assigned to the individual thread. In certain otherembodiments, an entity is an individual process, and the sub-buffer isassigned to the individual process. In further embodiments, the entityis a group of processes, and the sub-buffer is assigned to the group ofprocesses. The group of processes may be grouped using certain criteria(e.g., performing certain tasks, running on certain subset ofprocessors, etc.).

In certain embodiments, the free list of data segments is a First InFirst Out (FIFO) list. The FIFO list allows least recently freed/useddata segments to be integrated into sub-buffers; that way, when tracedata is collected and sorted, the traces tend to be more closely(temporally) related.

Embodiments provide sub-buffers with utilization based adaptive size,which eliminates many inefficiencies of other systems. Such a solutioncalculates the relative production of each entity and reassigns bufferspace (i.e., shrinks or grows individual sub-buffers) as needed.

With embodiments, there are multiple entities that share the main buffer120 that is divided into non-equal sized sub-buffers, and the managementthread 112 grows and shrinks the sub-buffers on a utilization basis(i.e., based on how much each of the sub-buffers is being used). Withembodiments, the total size of the sub-buffers is the size of the mainbuffer.

With embodiments,

-   -   Let Buffer (B) be a total main buffer available.    -   Let Sub-Buffer (SBx, where x is an integer) correspond to the        sub-buffer allocated to “entity x” (Ex).    -   Let the main buffer and the sub-buffers be comprised of fixed        sized data segments. However, in alternative embodiments, the        buffers are not segmented, but, segmenting the buffers makes        them easier to manage in certain situations. With embodiments,        the main buffer is the total space available, and the main        buffer is divided in equally sized data segments of memory.        Those data segments are picked at random to form sub-buffers. So        the sub-buffers are subsets of the main buffer; thus, the main        buffer and the sub-buffers are comprised (conceptually) of        one-sized segments. The sub-buffers are in effect a data        structure, an ordered list (linked list) of data segments. The        data segments within the sub-buffer are used in order and, as        one data segment gets used up, the user moves to the linked data        segment that follows the used one.    -   Let each entity Ex utilize its allocated sub-buffer SBx in a        circular fashion (i.e., when the entity reaches the end of its        sub-buffer, the entity will go back to the beginning of the        sub-buffer to continue its utilization).

The management thread 112 changes the size of a sub-buffer SBxproportionately to the corresponding entity's (Ex's) utilization (Ux)relative to the sum of utilizations by all the entities (E1 through En).

FIG. 2 illustrates a data segment control structure 200 in accordancewith certain embodiments. The data segment control structure 200includes a data segment identifier (ID), an assignment, a pointer to thebeginning of a data segment, a pointer to the end of the data segment,and a next_write_position (indicating where data (e.g., trace data)should be written next).

FIG. 3 illustrates a sub-buffer control structure 300 in accordance withcertain embodiments. The sub-buffer control structure 300 includes asub-buffer ID, an assignment, a current data segment ID, a sub-bufferlock, a next segment data segment ID, a last data segment ID, a numberof data segments, and a counter.

FIG. 4 illustrates a free list of data segments 400 in accordance withcertain embodiments. In FIG. 4, the free list of data segments 400includes data segment c, data segment w, ellipses representingadditional data segments, data segment v, and data segment d.

FIG. 5 illustrates a conceptual representation of a sub-buffer's datasegment ring in accordance with certain embodiments. In FIG. 5, the datasegment ring is formed by data segment z, data segment a, ellipsesrepresenting additional data segments, data segment t, and data segmentm. If data segment z is the current data segment, then data segment a isthe next data segment, and data segment m is the last data segment. Asthe data segments get used up, what used to be the current data segmentbecomes the last data segment, what used to be the next data segmentbecomes the current data segment, and the data segment after the currentdata segment becomes the next data segment.

FIG. 6 illustrates sub-buffer information and statistics 600 held by themanagement thread in accordance with certain embodiments. The sub-bufferinformation and statistics 600 include, for each sub-buffer ID, a copyof the sub-buffer counter, a utilization percentage, a number of datasegments, and data segment entitlement.

FIG. 7 illustrates a trace data format 700 in accordance with certainembodiments. The trace data format 700 includes a trace ID, an entityID, a timestamp, and trace data-1 . . . trace data-n (where the ellipsesrepresent additional trace data). Although examples and embodiments mayreference traces or trace data, embodiments of the invention are notlimited to traces or trace data.

FIG. 8 illustrates, in a flowchart, operations performed forinitialization in accordance with certain embodiments. Control begins atblock 800 with the sub-buffer allocation system 110 allocating a mainbuffer. In block 802, the sub-buffer allocation system 110 builds a listof data segments for the main buffer. This may include dividing a mainbuffer B into Z data segments. In certain embodiments, Z is a factor of100 and the number of entities (N), and is at least 2 times greater thanN. Merely to enhance understanding, an example is provided herein. Let Zrepresent the total number of data segments in the main buffer; and letN be the number of entities. Embodiments write the following equations:Z=100*F(where F is an integer)Z=J*N(where J is an integer greater than 2)

So, let N=1 k (1000), then, valid values for Z are 2 k, 3 k, 4 k, . . .etc.

With such embodiments, once the percentage utilization is rounded to thenearest whole value, the number of data segments to which an entity isentitled will also be a whole number, which will be equal to % Ux*F (asin Z=100*F above).

In block 804, the sub-buffer allocation system 110 adds the datasegments to a free list (FL) of data segments. In block 806, thesub-buffer allocation system 110 builds a list of sub-buffers and assigna data segment to each of the sub-buffers. This is done at the beginningof operations (e.g., time zero). At this time, the utilization of eachentity is unknown, and the sub-buffer allocation system 110 avoidsoverprovisioning the size of the sub-buffers. As the utilization becomesknown, the management thread 112 may add more data segments or removedata segments from each sub-buffer SBx.

In certain embodiments, the management thread 112 performs theinitialization before any user uses the sub-buffers by putting all ofthe data segments on the free list of data segments. Then, as users needto trace, the management thread 112 assigns sub-buffers (i.e., a subsetof the data segments from the main buffer) to those users.

FIG. 9 illustrates, in a flowchart, operations performed to re-size eachof the sub-buffers in accordance with certain embodiments. In certainembodiments, the processing of FIG. 9 is performed periodically (e.g.,for every pre-determined time period). With various embodiments, theprocessing of FIG. 9 may be implemented in any manner in which thesampling time span is none too large nor small to allow for accurateapproximations for current utilizations and effective sub-buffer sizechange. For example, embodiments may implement a time period that is notfixed or that may be dynamically changed by the system or a system user.

Control begins at block 900 with the management thread 112 summing upsub-buffer counters SBCxs of the sub-buffers SBxs.Σ(SBCx)

In block 902, the management thread 112 calculates a percentageutilization of each entity Ex by dividing the assigned sub-buffercounter by the sum of the sub-buffer counters and multiplying this by100% (a hundred percent).% Ux=(SBCx/Σ(SBCx))*100%

In block 904, the management thread 112 records (stores) a new number ofentitled data segments for each sub-buffer SBx based on the percentageof utilization for each entity Ex. That is, the management thread 112records the equivalent percentage of data segments that each sub-bufferSBx may contain:NumSegFor(SBx)=% Ux*Z/100 data segments.

With embodiments, the new number of entitled data segments is notnecessarily the number of data segments that will actually be assignedto the sub-buffer.

In block 906, the management thread 112 collects (copies) the value ofeach of the sub-buffer counters and resets them. This is done in certainembodiments before doing any calculations to avoid having users wait fortheir counters to be relinquished before performing traces.

In block 908, the management thread 112 decrements a number of datasegments for each sub-buffer SBx of each entity Ex whose percentageutilization indicates that the associated sub-buffer SBx is to shrinkand adds these newly freed data segments to the free list of datasegments.

In block 910, the management thread 112 increments a number of datasegments (obtained from the free list of data segments) for eachsub-buffer SBx of each entity Ex whose percentage utilization indicatesthat the associated sub-buffer SBx is to grow.

With embodiments, the entity increments a counter SBCx associated withsub-buffer SBx with each use of the sub-buffer SBx. In addition, theentity continues to use sub-buffer SBx regardless of any change in sizeof the sub-buffer SBx (based on the processing of FIG. 9).

Merely to enhance understanding an example of calculating percentageutilization is provided herein. With this example, there are 4 entities(G1, G2, G3, G4), there is a 100 Kilobytes of main buffer divided into100 segments of 1 Kilobyte each, and one second is the sampling timeperiod. At time T1, G1's counter reads 1, G2's counter reads 4, G3'scounter reads 3, and G4's counter reads 2. The following are thepercentage utilization for G1, G2, G3, and G4:% U1=(1/(1+4+3+2))*100%=1/10*100%=10%% U2=(4/(1+4+3+2))*100%=4/10*100%=40%% U3=(3/(1+4+3+2))*100%=3/10*100%=30%% U4=(2/(1+4+3+2))*100%=2/10*100%=20%

Thus, G1's sub-buffer is entitled to 10 data segments, G2's sub-bufferis entitled to 40 data segments, G3's sub-buffer is entitled to 30 datasegments, and G4's sub-buffer is entitled to 20 data segments.

At time T2, G1's counter=G2's counter=G3's counter=G4's counter=2. Thefollowing are the percentage utilization for G1, G2, G3, and G4:% U1=% U2=% U3=% U4=25%

Thus all 4 sub-buffers are entitled to 25 data segments each. So, G1'ssub-buffer may gain 15 data segments, and G4's sub-buffer may gain 5data segments. In addition, G2's sub-buffer may relinquish 15 datasegments, while G3's sub-buffer may relinquish 5 data segments.

With embodiments, the management thread 112 may add or remove apredetermined maximum number of data segments to/from a sub-buffer toprevent unnecessary oscillation or resonance. For example, in certainembodiments, at most 1 segment is added to a sub-buffer at any giventime and at most 2 segments are removed from a sub-buffer at any giventime.

With embodiments, at any moment, all the system traces may be retrievedand sorted by time (based on a timestamp), entity/group ID, thread ID,process ID, and/or Central Processing Unit (CPU) ID by collecting thecontents of all the data segments (i.e., the main buffer) regardless ofthe status of any individual data segment. With various embodiments,each trace entry may, in addition to data pertinent to the current codeexecution, record the current time stamp, the entity/group ID, thethread ID, the process ID, and/or the CPU ID.

FIGS. 10A and 10B illustrate, in a flowchart, operations performed forcounter collection and sub-buffer size entitlement calculation inaccordance with certain embodiments. Control begins at block 1000 withthe management thread 112 getting a list of sub-buffers. In block 1002,the management thread 112 selects a next sub-buffer, starting with afirst sub-buffer on the list. In block 1004, the management thread 112determines whether the lock for the sub-buffer has been taken. If so,processing continues to loop until the lock is obtained, otherwise,processing continues to block 1006.

In block 1006, the management thread 112 takes the lock for thesub-buffer. In block 1008, the management thread 112 copies a tracecounter to a local list. In block 1010, the management thread 112 erasesthe trace counter. From block 1010 (FIG. 10A), processing continues toblock 1012 (FIG. 10B).

In block 1012, the management thread 112 releases the lock for thesub-buffer. In block 1014, the management thread 112 determines whetherthe sub-buffer is the last on the list. If so, processing continues toblock 1016, otherwise, processing continues to block 1002 to select thenext sub-buffer.

In block 1016, the management thread 112 calculates the totalutilization by the sub-buffers. In block 1018, the management thread 112calculates the percentage utilization for each sub-buffer. In block1029, the management thread 112 determines a number of data segmentsthat each sub-buffer is entitled to.

FIGS. 11A and 11B illustrate, in a flowchart, operations for decreasinga sub-buffer size in accordance with certain embodiments. Control beginsat block 1100 with the management thread 112 getting a list ofsub-buffers. In block 1102, the management thread 112 selects a nextsub-buffer, starting with a first sub-buffer on the list. In block 1104,the management thread 112 determines whether a current number of datasegments is greater than (>) an entitled number of data segments. If so,processing continues to block 1106, otherwise, processing continues toblock 1108.

In block 1108, the management thread 112 determines whether there aremore sub-buffers to process. If so, processing loops to block 1102 (FIG.11A) to select the next sub-buffer, otherwise, processing is done.

In block 1106, the management thread 112 determines whether the lock forthe sub-buffer has been taken. If so, processing continues to loop untilthe lock is obtained, otherwise, processing continues to block 1110.

In block 1110, the management thread 112 takes the lock for thesub-buffer. In block 1112, the management thread 112 determines a numberof data segments to remove (current number of data segments—entitlednumber of data segments) OR one. That is, in some embodiments, thenumber of data segments to remove is one, and in other embodiments, thenumber of data segments to remove is based on current number of datasegments—entitled number of data segments. From block 1112 (FIG. 11A),processing continues to block 1114 (FIG. 11B).

In block 1114, the management thread 1112 removes a last data segment inthe sub-buffer's chain of data segments. In block 1116, the managementthread 112 adds the removed data segment to a free list of datasegments. In block 1118, the management thread 112 determines whetherthere are more data segments to remove. If so, processing continues toblock 1114, otherwise, processing continues to block 1120. In block1120, the management thread 112 releases the lock for the sub-buffer. Inblock 1122, the management thread 112 determines whether there are moresub-buffers to process. If so, processing loops to block 1102 (FIG. 11A)to select the next sub-buffer, otherwise, processing is done.

FIGS. 12A and 12B illustrate, in a flowchart, operations for increasinga sub-buffer size in accordance with certain embodiments. Control beginsat block 1200 with the management thread 112 getting a list ofsub-buffers. In block 1202, the management thread 112 selects a nextsub-buffer, starting with a first sub-buffer on the list. In block 1204,the management thread 112 determines whether a current number of datasegments is less than (<) an entitled number of data segments. If so,processing continues to block 1206, otherwise, processing continues toblock 1208.

In block 1208, the management thread 112 determines whether there aremore sub-buffers to process. If so, processing loops to block 1202 (FIG.12A) to select the next sub-buffer, otherwise, processing is done.

In block 1206, the management thread 112 determines whether the lock forthe sub-buffer has been taken. If so, processing continues to loop untilthe lock is obtained, otherwise, processing continues to block 1210.

In block 1210, the management thread 112 takes the lock for thesub-buffer. In block 1212, the management thread 112 gets one datasegment from the free list of data segments. From block 1212 (FIG. 12A),processing continues to block 1214 (FIG. 12B).

In block 1214, the management thread 1212 appends the data segment tothe sub-buffer's chain of data segments as the last data segment in thechain. In block 1216, the management thread 112 releases the lock forthe sub-buffer. In block 1218, the management thread 112 determineswhether there are more sub-buffers to process. If so, processing loopsto block 1202 (FIG. 12A) to select the next sub-buffer, otherwise,processing is done.

FIGS. 13A and 13B illustrate, in a flowchart, operations performed for atrace in accordance with certain embodiments. Each entity performs theoperations of FIG. 4. Control begins at block 1300 with the entityfinding a lock for a sub-buffer assigned to the entity. In block 1302,the entity determines whether the lock for the sub-buffer has been takenby another entity. If so, processing continues to loop until the lock isobtained, otherwise, processing continues to block 1304.

In block 1304, the entity takes the lock for the sub-buffer. In block1306, the entity increments a counter for the sub-buffer. In block 1308,the entity copies a value of the sub-buffer's current data segment'snext_write_position. In block 1310, the entity calculates where currenttrace data will end in the current data segment. From block 1310 (FIG.13A), processing continues to block 1312 (FIG. 13B).

In block 1312, the entity changes the current data segment'snext_write_position to a location of a byte right after the calculatedend of the current trace data. In block 1314, the entity calculatesspace left in the current data segment (end of current datasegment—next_write_position). In block 1316, the entity determineswhether the space is too small for another trace. If so, processingcontinues to block 1318, otherwise, processing continues to block 1320.

In block 1318, the entity sets a next data segment in the sub-buffer asthe current data segment. In block 1320, the entity releases the lockfor the sub-buffer. In block 1322, the entity writes trace data at thelocation indicated by the copied value of the sub-buffer's current datasegment's next_write_position.

Certain embodiments are directed to tracing in a computing device, wheremultiple entities share the main buffer that divided into non-equalsized sub-buffers having a management thread dynamicallyallocating/distributing data segments within the shared main bufferbased on the utilization of the sub-buffers by entities.

In certain embodiments, the management thread tracks the entities'sub-buffer utilization and handles the sub-buffer sizing.

Embodiments allocate sub-buffers made of blocks of memory to threadsthat need to use them. With embodiments, those sub-buffers are resizedwhen skews are found between the threads utilization of the allocatedresources.

Certain embodiments use random memory blocks (data segments) from a bigshared main buffer to make the sub-buffers. With that infrastructure inplace, data segments may be taken from any under-utilized sub-buffer tocomplement a heavily utilized one.

FIG. 14 illustrates a computing architecture in which the components ofFIG. 1 may be implemented. In certain embodiments, computing device 100may implement computer architecture 1400.

Computer system/server 1402 may be described in the general context ofcomputer system executable instructions, such as program modules, beingexecuted by a computer system. Generally, program modules may includeroutines, programs, objects, components, logic, data structures, and soon that perform particular tasks or implement particular abstract datatypes. Computer system/server 1402 may be practiced in distributed cloudcomputing environments where tasks are performed by remote processingdevices that are linked through a communications network. In adistributed cloud computing environment, program modules may be locatedin both local and remote computer system storage media including memorystorage devices.

Certain embodiments are directed to dynamically changing thesize/allocation of data segments of a shared main buffer allocated tomultiple threads/processes based on the utilization rate of the datasegments by utilizing a management thread.

With embodiments, the management thread is able to assign random datasegments from the shared main buffer to the sub-buffers. With thatinfrastructure in place, data segments may be taken from anyunderutilized sub-buffer to complement a heavily utilized sub-buffer.With embodiments, data segments may be transferred between thesub-buffers.

As shown in FIG. 14, the computer system/server 1402 is shown in theform of a general-purpose computing device. The components of computersystem/server 1402 may include, but are not limited to, one or moreprocessors or processing units 1404, a system memory 1406, and a bus1408 that couples various system components including system memory 1406to processor 1404. Bus 1408 represents one or more of any of severaltypes of bus structures, including a memory bus or memory controller, aperipheral bus, an accelerated graphics port, and a processor or localbus using any of a variety of bus architectures. By way of example, andnot limitation, such architectures include Industry StandardArchitecture (ISA) bus, Micro Channel Architecture (MCA) bus, EnhancedISA (EISA) bus, Video Electronics Standards Association (VESA) localbus, and Peripheral Component Interconnects (PCI) bus.

Computer system/server 1402 typically includes a variety of computersystem readable media. Such media may be any available media that isaccessible by computer system/server 1402, and it includes both volatileand non-volatile media, removable and non-removable media.

System memory 1406 can include computer system readable media in theform of volatile memory, such as random access memory (RAM) 1410 and/orcache memory 1412. Computer system/server 1402 may further include otherremovable/non-removable, volatile/non-volatile computer system storagemedia. By way of example only, storage system 1413 can be provided forreading from and writing to a non-removable, non-volatile magnetic media(not shown and typically called a “hard drive”). Although not shown, amagnetic disk drive for reading from and writing to a removable,non-volatile magnetic disk (e.g., a “floppy disk”), and an optical diskdrive for reading from or writing to a removable, non-volatile opticaldisk such as a CD-ROM, DVD-ROM or other optical media can be provided.In such instances, each can be connected to bus 1408 by one or more datamedia interfaces. As will be further depicted and described below,memory 1406 may include at least one program product having a set (e.g.,at least one) of program modules that are configured to carry out thefunctions of embodiments of the invention.

Program/utility 1414, having a set (at least one) of program modules1416, may be stored in memory 1406 by way of example, and notlimitation, as well as an operating system, one or more applicationprograms, other program modules, and program data. Each of the operatingsystem, one or more application programs, other program modules, andprogram data or some combination thereof, may include an implementationof a networking environment. The components of the computer 1402 may beimplemented as program modules 1416 which generally carry out thefunctions and/or methodologies of embodiments of the invention asdescribed herein. The systems of FIG. 1 may be implemented in one ormore computer systems 1402, where if they are implemented in multiplecomputer systems 1402, then the computer systems may communicate over anetwork.

Computer system/server 1402 may also communicate with one or moreexternal devices 1418 such as a keyboard, a pointing device, a display1420, etc.; one or more devices that enable a user to interact withcomputer system/server 1402; and/or any devices (e.g., network card,modem, etc.) that enable computer system/server 1402 to communicate withone or more other computing devices. Such communication can occur viaInput/Output (I/O) interfaces 1422. Still yet, computer system/server1402 can communicate with one or more networks such as a local areanetwork (LAN), a general wide area network (WAN), and/or a publicnetwork (e.g., the Internet) via network adapter 1424. As depicted,network adapter 1424 communicates with the other components of computersystem/server 1402 via bus 1408. It should be understood that althoughnot shown, other hardware and/or software components could be used inconjunction with computer system/server 1402. Examples, include, but arenot limited to: microcode, device drivers, redundant processing units,external disk drive arrays, RAID systems, tape drives, and data archivalstorage systems, etc.

The terms “an embodiment”, “embodiment”, “embodiments”, “theembodiment”, “the embodiments”, “one or more embodiments”, “someembodiments”, and “one embodiment” mean “one or more (but not all)embodiments of the present invention(s)” unless expressly specifiedotherwise.

The terms “including”, “comprising”, “having” and variations thereofmean “including but not limited to”, unless expressly specifiedotherwise.

The enumerated listing of items does not imply that any or all of theitems are mutually exclusive, unless expressly specified otherwise.

The terms “a”, “an” and “the” mean “one or more”, unless expresslyspecified otherwise.

Devices that are in communication with each other need not be incontinuous communication with each other, unless expressly specifiedotherwise. In addition, devices that are in communication with eachother may communicate directly or indirectly through one or moreintermediaries.

A description of an embodiment with several components in communicationwith each other does not imply that all such components are required. Onthe contrary a variety of optional components are described toillustrate the wide variety of possible embodiments of the presentinvention.

When a single device or article is described herein, it will be readilyapparent that more than one device/article (whether or not theycooperate) may be used in place of a single device/article. Similarly,where more than one device or article is described herein (whether ornot they cooperate), it will be readily apparent that a singledevice/article may be used in place of the more than one device orarticle or a different number of devices/articles may be used instead ofthe shown number of devices or programs. The functionality and/or thefeatures of a device may be alternatively embodied by one or more otherdevices which are not explicitly described as having suchfunctionality/features. Thus, other embodiments of the present inventionneed not include the device itself.

The foregoing description of various embodiments of the invention hasbeen presented for the purposes of illustration and description. It isnot intended to be exhaustive or to limit the invention to the preciseform disclosed. Many modifications and variations are possible in lightof the above teaching. It is intended that the scope of the invention belimited not by this detailed description, but rather by the claimsappended hereto. The above specification, examples and data provide acomplete description of the manufacture and use of the composition ofthe invention. Since many embodiments of the invention can be madewithout departing from the spirit and scope of the invention, theinvention resides in the claims herein after appended.

Additional Embodiment Details

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

What is claimed is:
 1. A computer program product, the computer programproduct comprising a computer readable storage medium having programcode embodied therewith, the program code executable by at least oneprocessor to perform operations, the operations comprising: forming aplurality of sub-buffers that are each assigned one or more datasegments of a main buffer; identifying multiple entities; assigning asub-buffer of the plurality of sub-buffers to each entity of themultiple entities; determining a percentage utilization for each entityby: obtaining a sub-buffer counter for each entity; summing up eachsub-buffer counter to generate a sum of the sub-buffer counters; andcalculating a percentage utilization for each entity by dividing thesub-buffer counter for that entity by the sum of the sub-buffer countersand multiplying by a hundred percent; and for each sub-buffer assignedto each entity, based on the percentage utilization for the entity andan existing number of data segments assigned to the sub-buffer,performing one of allocating at least one random data segment from afree list of data segments and removing at least one data segment tochange a size of the sub-buffer.
 2. The computer program product ofclaim 1, wherein each entity is any user of the sub-buffer.
 3. Thecomputer program product of claim 1, wherein each sub-buffer is acircular buffer formed by a chain of the assigned one or more datasegments.
 4. The computer program product of claim 1, wherein theprogram code is executable by the at least one processor to performoperations, the operations further comprising: storing a data segmentcontrol structure, a sub-buffer control structure, and sub-bufferinformation and statistics.
 5. The computer program product of claim 1,wherein each entity is utilizing the assigned sub-buffer.
 6. A computersystem, comprising: one or more processors, one or morecomputer-readable memories and one or more computer-readable, tangiblestorage devices; and program instructions, stored on at least one of theone or more computer-readable, tangible storage devices for execution byat least one of the one or more processors via at least one of the oneor more memories, to perform operations, the operations comprising:forming a plurality of sub-buffers that are each assigned one or moredata segments of a main buffer; identifying multiple entities; assigninga sub-buffer of the plurality of sub-buffers to each entity of themultiple entities; determining a percentage utilization for each entityby: obtaining a sub-buffer counter for each entity; summing up eachsub-buffer counter to generate a sum of the sub-buffer counters; andcalculating a percentage utilization for each entity by dividing thesub-buffer counter for that entity by the sum of the sub-buffer countersand multiplying by a hundred percent; and for each sub-buffer assignedto each entity, based on the percentage utilization for the entity andan existing number of data segments assigned to the sub-buffer,performing one of allocating at least one random data segment from afree list of data segments and removing at least one data segment tochange a size of the sub-buffer.
 7. The computer system of claim 6,wherein each entity is any user of the sub-buffer.
 8. The computersystem of claim 6, wherein each sub-buffer is a circular buffer formedby a chain of the assigned one or more data segments.
 9. The computersystem of claim 6, wherein the operations further comprise: storing adata segment control structure, a sub-buffer control structure, andsub-buffer information and statistics.
 10. The computer system of claim6, wherein each entity is utilizing the assigned sub-buffer.
 11. Amethod, comprising: forming, with a processor of a computer, a pluralityof sub-buffers that are each assigned one or more data segments of amain buffer; identifying multiple entities; assigning a sub-buffer ofthe plurality of sub-buffers to each entity of the multiple entities;determining a percentage utilization for each entity by: obtaining asub-buffer counter for each entity; summing up each sub-buffer counterto generate a sum of the sub-buffer counters; and calculating apercentage utilization for each entity by dividing the sub-buffercounter for that entity by the sum of the sub-buffer counters andmultiplying by a hundred percent; and for each sub-buffer assigned toeach entity, based on the percentage utilization for the entity and anexisting number of data segments assigned to the sub-buffer, performingone of allocating at least one random data segment from a free list ofdata segments and removing at least one data segment to change a size ofthe sub-buffer.
 12. The method of claim 11, wherein each entity is anyuser of the sub-buffer.
 13. The method of claim 11, wherein eachsub-buffer is a circular buffer formed by a chain of the assigned one ormore data segments.
 14. The method of claim 11, further comprising:storing a data segment control structure, a sub-buffer controlstructure, and sub-buffer information and statistics.
 15. The method ofclaim 11, wherein each entity is utilizing the assigned sub-buffer.